package com.example.demo.mapper;

import com.example.demo.pojo.Role;
import com.example.demo.pojo.RoleExample;
import java.util.List;

import org.apache.ibatis.annotations.*;

@Mapper
public interface RoleMapper {
    long countByExample(RoleExample example);

    int deleteByExample(RoleExample example);

    int deleteByPrimaryKey(Integer r_id);

    @Insert("insert into role(r_name, r_state) VALUES (#{r_name},#{r_state})")
    @Options(useGeneratedKeys = true,keyProperty = "r_id")
    int insert(Role record);

    int insertSelective(Role record);

    List<Role> selectByExample(RoleExample example);

    Role selectByPrimaryKey(Integer r_id);

    int updateByExampleSelective(@Param("record") Role record, @Param("example") RoleExample example);

    int updateByExample(@Param("record") Role record, @Param("example") RoleExample example);

    int updateByPrimaryKeySelective(Role record);

    int updateByPrimaryKey(Role record);

    //唯一性验证
    @Select(" select r_name from role where r_name = #{r_name}")
    List<Role> compare(Role role);

    @Select("select r_id,r_name from role order by r_id")
    List<Role> getRoleList();
}